#include <vector>
#include <algorithm>
using namespace std;
class Solution {
    vector<vector<int> > ans;
    vector<int> cur;
    void run(vector<int> &S, int n) {
        if (n==S.size()) {
            ans.push_back(cur);
            return;
        }
        run(S, n+1);
        cur.push_back(S[n]);
        run(S, n+1);
        cur.pop_back();
    }
public:
    vector<vector<int> > subsets(vector<int> &S) {
        sort(S.begin(), S.end());
        ans.clear();
        cur.clear();
        run(S, 0);
        return ans;
    }
};
